<div class="box">
    <div class="heading">
        <h1><img alt="" src="<?php echo base_url('assets/admin/images/review.png'); ?>"> All body Type</h1>
		<div class="buttons">
            <ul id="add_entry_btn">
                <li id="add_entry_li">
                    <a class="button" rel="#entry_content_types" id="add_entry" href="<?php echo base_url(ADMIN_PATH . '/alan/bodytype'); ?>"><span>Add</span></a>
                </li>
                
                <li>
                    <a class="button delete" href="#"><span>Delete</span></a>
                </li>
            </ul>
        </div>  
    </div>
    <div class="content">
		<?php echo form_open(); ?>
        <div class="filter">
            <div class="left">
                <div><label>body Type:</label></div> 
                <input type="text" name="bodytype" value="<?=isset($bodyeditdata)?$bodyeditdata['name']:''?>" />
				<input type="hidden" name="id" value="<?=isset($bodyeditdata)?$bodyeditdata['id']:''?>" /></td>
            </div>
            
            <div class="left filter_buttons">
                <button name="submit" class="button" type="submit"><span><?=isset($bodyeditdata)?'Update':'Add'?></span></button>
            </div>
            <div class="clear"></div>
        </div>
        <?php echo form_close(); ?>

		<?php echo form_open(null, 'id="form"'); ?>
        <table id="entries_table" class="list">
            <thead>
                <tr>
                    <th width="1" class="center"><input type="checkbox" onClick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></th>
                    <th>body Type</th>
                    <th>Status</th>
                    <th class="right">Action</th>
                </tr>
            </thead>
            <tbody>
				<?php if ($bodytype){?>
                    <?php foreach($bodytype as $body){ ?>
                    <tr>
                        <td class="center"><input type="checkbox" value="<?php echo $body['id'] ?>" name="selected[]" /></td>
						<td><?php echo $body['name']; ?></td>
						<td><?php echo $body['status']; ?></td>
                        <td class="right">[ <?php echo anchor(ADMIN_PATH . "/alan/bodytype/?id=" . $body['id'], 'Edit'); ?> ]</td>
                    </tr>
                    <?php } ?>
                <?php }else { ?>
                    <tr class="center"><td colspan="4">No results found.</td></tr>
                <?php } ?>
            </tbody>
        </table>
		<div id="paging">
				<?php if($pagination): ?>
					
					<div class="pagination">
						<div class="links"><?php echo $pagination; ?></div>
					</div>
				<?php endif; ?>
			</div>
        <?php echo form_close(); ?>
        
    </div>
</div>
<script>
 // Delete
        $('.delete').click( function() {
            if (confirm('Delete cannot be undone! Are you sure you want to do this?'))
            {
                $('#form').attr('action', '<?php echo site_url(ADMIN_PATH . '/alan/deletebodytype'); ?>').submit()
            }
            else
            {
                return false;
            }
        });
</script>
